<script type="text/javascript">
$(function() {
	<?php for($i = 1; $i <= $uploadCount; $i++){?>
    $('#uploadify<?php echo $i;?>').uploadify({
        'buttonText'      	: '文件上传',
        'swf'      			: '/assets/uploadify/scripts/uploadify.swf',
        'uploader' 			: '<?php echo Yii::app()->createUrl("UploadFile/ImageUpload");?>',
        'cancelImg'			: '/assets/uploadify/img/uploadify-cancel.png',
        'auto' 				: true,
        'onUploadSuccess' 	: function(file, data, response) {
            var ad_img = $('#ad_img_path<?php echo $i;?>').val();
            var data = eval('('+data+')');

            if(data['statusCode'] == '200'){
				$("#image_play<?php echo $i;?> img").attr("src",data['forwardUrl']);
                $("#ad_img_path<?php echo $i;?>").val(data['forwardUrl']);
				$("#image_play<?php echo $i;?>").show();
				delImage(<?php echo $i;?>);
				data['forwardUrl'] = '';
				//dialogAjaxDone(data);
				return true;
            }else{
                //dialogAjaxDone(data);
                return false;
            }
        }
    });
	delImage(<?php echo $i;?>);
	<?php }?>
});
function delImage(num){
    $("#delbutton"+num).click(function(){
		$("#ad_img_path"+num).val('');
		$("#image_play"+num).hide();
    })
}
</script>